#include"db.hpp"

void TestDishTable(){
	MYSQL* mysql = order_system::MySQLInit();
	order_system::DishTable dish_table(mysql);
	Json::StyledWriter writer;

	/*Json::Value dish;		//插入测试
	dish["name"] = "唐僧肉";
	dish["price"] = 10000;
	bool ret = dish_table.Insert(dish);
	printf("ret = %d\n",ret);    */ 

	/*Json::Value dishes;		//查看所有菜品
	int ret =dish_table.SelectALL(&dishes);
	printf("ret = %d\n",ret);
	printf("%s\n",writer.write(dishes).c_str());*/

	
	/*Json::Value dish;			//查看指定菜品
	int ret = dish_table.SelectOne(1,&dish);
	printf("ret=%d\n",ret);
	printf("%s\n",writer.write(dish).c_str());*/

	Json::Value dish;
	dish["dish_id"]=1;
	dish["name"]="阿玛红烧肉";
	dish["price"]=2300;
	int ret = dish_table.Update(dish);
	printf("ret = %d\n",ret);
	
	order_system::MySQLRelease(mysql);
	}
void TestOrderTable(){

}
int main(){
	TestDishTable();
	return 0;
}